﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace P2PLib.Client.Command
{
    public class CCFileReadyCommand:CCCommandBase
    {
        private int port;

        public int Port
        {
            get
            {
                return this.port;
            }
            set
            {
                this.port = value;
            }
        }


        public CCFileReadyCommand()
            : base(CCCommandType.FileReady)
        { 
            
        }

        public override void ReadFromStream(System.IO.Stream stream)
        {
            byte[] buffer = new byte[4];
            stream.Read(buffer, 0, 4);
            this.port = BitConverter.ToInt32(buffer, 0);

        }

        public override void WriteToStream(System.IO.Stream stream)
        {
            byte[] buffer = BitConverter.GetBytes(this.port);
            stream.Write(buffer, 0, 4);
        }
    }
}
